package com.ygqh.baby.mapper;

import com.ygqh.baby.ao.CardMode;
import com.ygqh.baby.ao.CardType;
import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.ao.UseStatus;
import com.ygqh.baby.model.YgCardCouponInfo;
import com.ygqh.baby.po.YgCardCouponDetail;
import com.ygqh.baby.po.YgCardCouponDetailExample;
import com.ygqh.baby.po.YgUser;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface YgCardCouponDetailMapper {
	int countByExample(YgCardCouponDetailExample example);

	int deleteByExample(YgCardCouponDetailExample example);

	int deleteByPrimaryKey(Long id);

	int insert(YgCardCouponDetail record);

	int insertSelective(YgCardCouponDetail record);

	List<YgCardCouponDetail> selectByExample(YgCardCouponDetailExample example);

	YgCardCouponDetail selectByPrimaryKey(Long id);

	int updateByExampleSelective(@Param("record") YgCardCouponDetail record, @Param("example") YgCardCouponDetailExample example);

	int updateByExample(@Param("record") YgCardCouponDetail record, @Param("example") YgCardCouponDetailExample example);

	int updateByPrimaryKeySelective(YgCardCouponDetail record);

	int updateByPrimaryKey(YgCardCouponDetail record);

	int countSuper(@Param("cardType") CardType cardType, @Param("cardMode") CardMode cardMode, @Param("startDate") Date startDate,
				   @Param("endDate") Date endDate, @Param("q") String q);

	List<YgCardCouponDetail> selectSuper(@Param("queryInfo") QueryInfo queryInfo, @Param("cardType") CardType cardType, @Param("cardMode") CardMode cardMode,
										 @Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("q") String q);

	List<YgCardCouponInfo> selectCardInfoByUserId(@Param("cardDetailId") Long cardDetailId, @Param("userId") Long userId, @Param("useStatus") String useStatus);

	int receiveCard(@Param("cardId") Long cardId, @Param("sharer") Long sharer, @Param("receiver") Long receiver);

	YgCardCouponInfo selectCardInfoByDetailId(@Param("cardDetailId") Long cardDetailId);

	int receivedCount(@Param("cardType") CardType cardType, @Param("userId") Long userId);

	List<YgCardCouponDetail> selectByUnUsedCardCoupon();

	List<YgCardCouponDetail> selectCardCouponList(@Param("userId") Long userId, @Param("cardId") Long cardId, @Param("useStatus") UseStatus useStatus,
												  @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("overdueDate") String overdueDate,
												  @Param("types") CardType... types);

	int updateByReturnExpress(@Param("userId") Long userId, @Param("relationId") Long relationId);

	List<YgCardCouponInfo> selectByCardIdAndUserId(@Param("cardId") Long cardId, @Param("userId") Long userId);

	List<YgUser> selectReceiveUserListBySource(@Param("cardId") Long cardId, @Param("sourceCode") String sourceCode);
}
